package java学习.第18章_JDK8_17新特性;

import org.junit.Test;

public class JDK13_15文本块新特性 {
    @Test //JDK 13
    public void test(){
        //一般你复制文本的时候  会自动补 \n ,且复制出去时  不好
        //海带之双引号  和\n 之类的
        String s ="<script>\n" +
                "  var userAgent = navigator.userAgent;\n" +
                "  var isLessIE11 = userAgent.indexOf('compatible') > -1 && userAgent.indexOf('MSIE') > -1;\n" +
                "  if(isLessIE11){\n" +
                "    var can_access = \"\"\n" +
                "    if (can_access != \"true\"){\n" +
                "      window.location.href = \"/incompatible.html\";\n" +
                "    }\n" +
                "  }\n" +
                "</script>";

        //新的  这样看就很干净了
        String info = """
                <script>
                  var userAgent = navigator.userAgent;
                  var isLessIE11 = userAgent.indexOf('compatible') > -1 && userAgent.indexOf('MSIE') > -1;
                  if(isLessIE11){
                    var can_access = ""
                    if (can_access != "true"){
                      window.location.href = "/incompatible.html";
                    }
                  }
                </script>
                """;

    }

    /**
     * JDK14
     * \  :取消换行
     * \s :表示一个空格
     */
    @Test
    public void JDK14(){
        String s = """
                SELECT id,name,email
                FROM user\s\
                WHERE id>6
                limit 5;
                """;
        System.out.println(s);
    }
}
